import java.util.Random;

public class aa {
    public static void main(String[] args) {
//        int[] a= {1,2,3};
//        int[] a2= {1,2,3};
//        System.out.println(isSame(a, a2));
//        getIndex2(new int[]{1, 2, 3,4,4}, 4);
//        System.out.println(getIndex(new int[]{1, 2, 3}, 4));
//        swapArr(new int[]{1, 2, 3,4,5,6});
//        swapArr2(10,20);
//        swapArr4(new int[]{1,2,3,4,5,6});
//        swapArr3(new int[]{1,2,3,4,5,6});
//        svg(new int[]{1,2,3,4,5,6});
        for (int i = 0; i < 10; i++) {
            randomFlag();
        }
    }
    public static void randomFlag(){
        char[] arr = {
                'a','b','c',
                'A','B','C',
                '0','1','2'
        };
        String s = "";
        for (int i = 0; i < 5; i++) {
            s += arr[new Random().nextInt(9)] ;
        }

        System.out.println(s);

    }
    public static void svg(int[]  arr){
        int max = arr[0];
        int min = arr[0];
        int count = 0;
        for (int i = 0; i < arr.length; i++) {
            if(max < arr[i]){
                max = arr[i];
            }
            if(min > arr[i]){
                min = arr[i];
            }
            count+=arr[i];
        }
        count -=max;
        count -=min;
        double res  = (double) count/4;
        System.out.println(res);
    }
    public static void swapArr4(int[]  arr){ // 不操作第三个值
        int start = 0;
        int end = arr.length -1;
        for (int i = 0; i < arr.length; i++) {
            if(start > end)break;
            int f = arr[start];
            arr[i] = arr[end];
            arr[end] = f;
            start++;
            end--;
        }
        for (int i = 0; i < arr.length; i++) {
            System.out.println(arr[i]);
        }
    }
    public static void swapArr3(int[]  arr){ // 不操作第三个值
        for (int i = 0; i < arr.length; i++) {
            if(i == arr.length/2){
                break;
            }
            int f = arr[i];
            arr[i] = arr[arr.length-1- i];
            arr[arr.length- 1-i] = f;
        }
        for (int i = 0; i < arr.length; i++) {
            System.out.println(arr[i]);
        }
    }
    public static void swapArr2(int a ,int b){ // 不操作第三个值
        /*
         * ^ 异或 : 相同是false,不同是true  男女是true, 男男是false,女女是false
         *  数字被异或 两次, 本身不变换.
         *  异或计算流程:
         *    1. 需要运算的数据,转换为二进制.
         *       00001010    -- 10
         *       00000010       2
         * ------------------------
         *       00001000
         * ------------------------
         * 转换为十进制  就是      8
         * */
        a = a ^ b; // a = 10 ^ 20 不要计算结果
        b = a ^ b; // b = 10 ^ 20  =  10 ^ 20 ^ 20 本身不变, b是原本a的10
        a = a ^ b; // a = 10 ^ 20 ^ 10(b上一轮是10了),所以20这个数字被10 异或两次,所以值是20不变.  那a就是10;
        System.out.println(a);
        System.out.println(b);
    }
    public static void swapArr(int[] arr){
        int[] res = new int[arr.length];
        for (int i = 0; i < arr.length; i++) {
            if(arr.length/2 == i){
                res[i] = arr[i];
                break;
            }
            res[i] = arr[arr.length-1-i];
            res[arr.length-1-i] = arr[i];
        }
        for (int i = 0; i < arr.length; i++) {
            System.out.println("arr原本数组:" + arr[i]);
        }
        System.out.println("------------");
        for (int i = 0; i < res.length; i++) {
            System.out.println("新数组:" +res[i]);
        }

    }
    public static void getIndex2(int[] arr,int val){
        int index = 0;
        for (int i = 0; i < arr.length; i++) {
            if(arr[i] == val){
                index +=1;
            }
        }
        int[] res = new int[index];
        for (int i = 0; i < arr.length; i++) {
            if(arr[i] == val){
                res[index-1] = i;
                index--;
            }
        }
        for (int i = 0; i < res.length; i++) {
            System.out.println(res[i]);
        }
    }
    public static int getIndex(int[] arr,int val){
        int index = -1;
        for (int i = 0; i < arr.length; i++) {
            if(arr[i] == val){
                index = i;
                break;
            }
        }
        return index;
    }
    public static boolean isSame(int[] arr1,int[] arr2){
        if(arr1.length != arr2.length)return  false;
        for (int i = 0; i < arr1.length; i++) {
           if( arr1[i] != arr2[i]){
               return  false;
           }
        }
        return true;
    }
}
